package com.yanqu.road.server.logic.bag;

import com.yanqu.road.entity.bag.UseGoodsResult;
import com.yanqu.road.entity.config.goods.GoodsInfo;
import com.yanqu.road.entity.enums.eSystemId;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.player.OreWarModule;
import com.yanqu.road.server.manger.config.SystemOpenMgr;
import com.yanqu.road.server.protocol.GameErrorCode;

public class UseRecoverOreWarHpPower extends BaseUseGoods {

    public UseRecoverOreWarHpPower(GamePlayer player, GoodsInfo goodsInfo, long param) {
        super(player, goodsInfo, param);
    }

    @Override
    int checkUse(long count) {
        if(!SystemOpenMgr.systemOpen(player, eSystemId.OreWar.getValue())){
            return GameErrorCode.E_SYSTEM_NO_OPEN;
        }
        return 0;
    }

    @Override
    UseGoodsResult executeUse(long count) {
        player.getModule(OreWarModule.class).addHp(count,(int)param);
        return new UseGoodsResult();
    }
}
